<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>开灯</button>
    <button>关灯</button>
    <script src="./jquery-1.12.4.js"></script>
    <script>
        $(function () {
            //给按钮添加事件：设置body的背景色
            //1.获取到按钮
            var btns = document.getElementsByTagName("button");
            //2.给关灯按钮设置点击事件
            btns[1].onclick = function () {
                $('body').css('background', 'black')
            }
            //2.给开灯按钮设置点击事件
            $(btns[0]).click(function () {
                $('body').css('background', '#fff')
            });


        })
    </script>
</body>

</html>